{extend name="public:head"}
{block name="main"}

<form class="layui-form" action="/admin/Popularize/addAccount" method="POST">

    <div class="layui-form-item">
        <label class="layui-form-label">公司名</label>
        <div class="layui-input-inline" style="width:350px;">
            <input name="company_name" type="text" placeholder="请输入公司名" value="{$info['company_name']|default=''}" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">推广账号</label>
        <div class="layui-input-inline" style="width:350px;">
            <input type="hidden" name="id" value="{$info['id']|default=''}">
            <input type="hidden" name="scope" value="{$info['scope']|default='16'}">
            <input type="text" name="name" required lay-verify="required" placeholder="请输入账号" autocomplete="off" class="layui-input"  value="{$info['name']|default=''}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline" style="width:350px;">
            <input name="password" type="text" placeholder="请输入密码" value="" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">商家标识</label>
        <div class="layui-input-inline" style="width:350px;">
            <input name="logo" type="text" placeholder="请输入标识码" value="{$info['logo']|default=''}" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">短信接口</label>
        <div class="layui-input-inline" style="width:350px;">
            <select name="message_id" lay-filter="message_id" id="message_id">
                <option></option>$info['message_id']
                <option value="0" {if $info['message_id'] == 0}selected{/if}>普通</option>
                <option value="1" {if $info['message_id'] == 1}selected{/if}>阿里云</option>
            </select>
        </div>
    </div>

    <div class="layui-form-item" id="sign_name" style="display: none">
        <label class="layui-form-label">阿里云签名</label>
        <div class="layui-input-inline" style="width:350px;">
            <input name="sign_name" type="text" placeholder="阿里云签名" value="{$info['sign_name']|default=''}" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item" id="template_code" style="display: none">
        <label class="layui-form-label">短信模板ID</label>
        <div class="layui-input-inline" style="width:350px;">
            <input name="template_code" type="text" placeholder="阿里云里面模板id" value="{$info['template_code']|default=''}" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">单期域名</label>
        <div class="layui-input-inline" style="width:350px;">
            <input name="host_d" type="text" placeholder="单期域名" value="{$info['host_d']|default=''}" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">分期域名</label>
        <div class="layui-input-inline" style="width:350px;">
            <input name="host_f" type="text" placeholder="分期域名" value="{$info['host_f']|default=''}" class="layui-input" >
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <input type="checkbox" name="status" lay-skin="switch" lay-text="启用|禁用" lay-filter="switchTest" value="1" {if $info.status == '1'}checked{/if}>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">重复</label>
        <div class="layui-input-block">
            <input type="checkbox" name="repeat" lay-skin="switch" lay-text="允许|禁用" lay-filter="switchTest" value="1" {if $info.repeat == '1'}checked{/if}>
<!--            <div class="layui-unselect layui-form-switch" lay-skin="_switch">-->
<!--                <em>OFF</em><i></i>-->
<!--            </div>-->
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="formDemo">提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>

</form>

<script type="text/javascript">

    var select_data= $("#message_id").val();
    if(select_data == 1){
        $("#sign_name").css("display","block");
        $("#template_code").css("display","block");
    }


    layui.use(['form','layedit'], function(){
        var form = layui.form
        var upload  = layui.upload;

        form.on('select(message_id)', function(data){
            var value = data.value
            if(value == 0 || value==''){
                $("#sign_name").css("display","none");
                $("#template_code").css("display","none");
                form.render();
            }
            if(value == 1){
                $("#sign_name").css("display","block");
                $("#template_code").css("display","block");
            }
        });
    });

</script>

{/block}